| 1 | authorize | Patient invokes the authorize flow from the patient application. |
| 2 | redirect_to_oauth_screen | Patient is redirected to the Payer system's OAuth screen. |
| 3 | enter_credentials, provide_consent | Patient provides their credentials to provide consent to access their EOB data from the Payer server. |
| 4 | redirect_back_with_code | Patient is redirected to the confirmation screen with the code that can be used to generate refresh_token. |
| 5 | request_refresh_token | Using the code returned in the previous call, from the Patient application, a request is sent to Payer server for refresh_token. |
| 6 | refresh_token | A refresh_token is generated by the Payer server. |
| 7 | save_refresh_token | In the patient application, the refresh_token will be saved in named credentials and the reference to the named credentials will be mapped against the patient. |
| 8 | trigger_apex | An Apex scheduler is triggered as per the configuration (recommended configuration is once a week). |
| 9 | request_access_token | With the refresh_token generated a call is made to the Payer server to get the access_token. |
| 10 | access_token | The access_token returned by Payer server. |
| 11 | call_patient_sync | Using the generated access_token mulesoft API patient sync endpoint is called. |
| 12 | job_id | A unique identifier will be generated by Mulesoft API that can be used as correlation id. |
| 13 | request_eob_data | Mulesoft will call the BlueButton API to get the EOB data. |
| 14 | eob_data | The EOB data for a patient returned by blue button API. |
| 15 | transform | Transform the data to map salesforce entities and persist in respective entities. |
| 16 | save_clinical_data | Clinical data is saved in Salesforce HealthCloud. |
| 17 | save_claim_data | Claim data is saved in Salesforce DataCloud. |
| 18 | update_job_status | Update the job status back to salesforce custom object. |